﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MstartTemplate1.master" AutoEventWireup="true" CodeBehind="wishlistsearch.aspx.cs" Inherits="WebSite1.wishlistsearch" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
    .style1
    {
        width: 100%;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table class="style1">
    <tr>
        <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" BorderStyle="Inset" Text="Search" />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ess_prod_testConnectionString %>" 
                
                
                
                SelectCommand="SELECT wishlists.wishlist_id, wishlists.created, wishlists.wishlistname, wishlists.wishlist_cat_id, wedding_data.male_lname, wedding_data.male_fname, wedding_data.male_email, wedding_data.female_fname, wedding_data.female_lname, wedding_data.female_email, wedding_data.wedding_date, wedding_data.wedding_place, wishlist_cat.cat_name, CAST(COUNT(wishlist_items.item_id) AS varchar(1000)) + ' Item(s)' AS Expr1 FROM wishlists INNER JOIN wishlist_cat ON wishlists.wishlist_cat_id = wishlist_cat.cat_id INNER JOIN wishlist_items ON wishlists.wishlist_id = wishlist_items.wishlist_id LEFT OUTER JOIN wedding_data ON wishlists.wishlist_id = wedding_data.wishlist_id GROUP BY wishlists.wishlist_id, wishlists.created, wishlists.wishlistname, wishlists.wishlist_cat_id, wedding_data.male_lname, wedding_data.male_fname, wedding_data.male_email, wedding_data.female_fname, wedding_data.female_lname, wedding_data.female_email, wedding_data.wedding_date, wedding_data.wedding_place, wishlist_cat.cat_name HAVING (wishlists.wishlistname LIKE N'%' + @searchstring + N'%') OR (wedding_data.male_lname LIKE N'%' + @searchstring + N'%') OR (wedding_data.male_fname LIKE N'%' + @searchstring + N'%') OR (wedding_data.male_email LIKE N'%' + @searchstring + N'%') OR (wedding_data.female_fname LIKE N'%' + @searchstring + N'%') OR (wedding_data.female_lname LIKE N'%' + @searchstring + N'%') OR (wedding_data.female_email LIKE N'%' + @searchstring + N'%') OR (wedding_data.wedding_place LIKE N'%' + @searchstring + N'%')">
                <SelectParameters>
                    <asp:ControlParameter ControlID="TextBox1" Name="searchstring" 
                        PropertyName="Text" />
                </SelectParameters>
            </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
         ConnectionString="<%$ ConnectionStrings:ess_prod_testConnectionString %>" 
        
        
                SelectCommand="SELECT wishlist_items.id, wishlist_items.wishlist_id, wishlist_items.item_id, items.title, items.price, items.url FROM items INNER JOIN wishlist_items ON items.id = wishlist_items.item_id WHERE (wishlist_items.wishlist_id = @w_id)">
        <SelectParameters>
            <asp:ControlParameter ControlID="ListView1" Name="w_id" 
                PropertyName="SelectedValue"   />
        </SelectParameters>
    </asp:SqlDataSource> 
            <asp:ListView ID="ListView1" runat="server" DataKeyNames="wishlist_id" 
                DataSourceID="SqlDataSource1"  GroupItemCount="3" 
                onselectedindexchanged="ListView1_SelectedIndexChanged">
                <AlternatingItemTemplate>
                    <td runat="server" style="background-color:#FFF8DC;">
                         <asp:Label ID="wishlistnameLabel" runat="server"  Text='<%# Eval("wishlistname") %>' /><br />
                          <small>created on: <asp:Label ID="createdLabel" runat="server" Text='<%#  Eval("created").ToString().Substring (1,10) %>' />
                        </small> <br />
                         &nbsp;<asp:Label ID="male_lnameLabel" runat="server" 
                            Text='<%# Eval("male_lname") %>' />
                         &nbsp;<asp:Label ID="male_fnameLabel" runat="server" 
                            Text='<%# Eval("male_fname") %>' />
                         
                        <asp:Label ID="male_emailLabel" runat="server" 
                            Text='<%# Eval("male_email") %>' />
                         &nbsp;<asp:Label ID="female_fnameLabel" runat="server" 
                            Text='<%# Eval("female_fname") %>' />
                         &nbsp;<asp:Label ID="female_lnameLabel" runat="server" 
                            Text='<%# Eval("female_lname") %>' />
                         
                        <asp:Label ID="female_emailLabel" runat="server" 
                            Text='<%# Eval("female_email") %>' />
                         &nbsp;<asp:Label ID="wedding_dateLabel" runat="server" 
                            Text='<%# Eval("wedding_date") %>' /> 
                            <br /><small>place:
                        <asp:Label ID="wedding_placeLabel" runat="server" 
                            Text='<%# Eval("wedding_place") %>' /></small><br />

                         <small>category: <asp:Label ID="cat_nameLabel" runat="server" 
                            Text='<%# Eval("cat_name") %>' /></small> 
                        <br />
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                CommandName="Select" Text='<%#  Bind("Expr1") %>'></asp:LinkButton>
                    </td>
                </AlternatingItemTemplate>
                <EditItemTemplate>
                    <td runat="server" style="background-color:#008A8C;color: #FFFFFF;">
                        wishlist_id:
                        <asp:Label ID="wishlist_idLabel1" runat="server" 
                            Text='<%# Eval("wishlist_id") %>' />
                        <br />created:
                        <asp:TextBox ID="createdTextBox" runat="server" Text='<%# Bind("created") %>' />
                        <br />wishlistname:
                        <asp:TextBox ID="wishlistnameTextBox" runat="server" 
                            Text='<%# Bind("wishlistname") %>' />
                        <br />wishlist_cat_id:
                        <asp:TextBox ID="wishlist_cat_idTextBox" runat="server" 
                            Text='<%# Bind("wishlist_cat_id") %>' />
                        <br />male_lname:
                        <asp:TextBox ID="male_lnameTextBox" runat="server" 
                            Text='<%# Bind("male_lname") %>' />
                        <br />male_fname:
                        <asp:TextBox ID="male_fnameTextBox" runat="server" 
                            Text='<%# Bind("male_fname") %>' />
                        <br />male_email:
                        <asp:TextBox ID="male_emailTextBox" runat="server" 
                            Text='<%# Bind("male_email") %>' />
                        <br />female_fname:
                        <asp:TextBox ID="female_fnameTextBox" runat="server" 
                            Text='<%# Bind("female_fname") %>' />
                        <br />female_lname:
                        <asp:TextBox ID="female_lnameTextBox" runat="server" 
                            Text='<%# Bind("female_lname") %>' />
                        <br />female_email:
                        <asp:TextBox ID="female_emailTextBox" runat="server" 
                            Text='<%# Bind("female_email") %>' />
                        <br />wedding_date:
                        <asp:TextBox ID="wedding_dateTextBox" runat="server" 
                            Text='<%# Bind("wedding_date") %>' />
                        <br />wedding_place:
                        <asp:TextBox ID="wedding_placeTextBox" runat="server" 
                            Text='<%# Bind("wedding_place") %>' />
                        <br />cat_name:
                        <asp:TextBox ID="cat_nameTextBox" runat="server" 
                            Text='<%# Bind("cat_name") %>' />
                        <br />Expr1:
                        <asp:TextBox ID="Expr1TextBox" runat="server" Text='<%# Bind("Expr1") %>' />
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <br />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                        <br />
                    </td>
                </EditItemTemplate>
                <EmptyDataTemplate>
                    <table runat="server" 
                        style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                        <tr>
                            <td>
                                No data was returned.</td>
                        </tr>
                    </table>
                </EmptyDataTemplate>
                <EmptyItemTemplate>
<td runat="server" />
                </EmptyItemTemplate>
                <GroupTemplate>
                    <tr ID="itemPlaceholderContainer" runat="server">
                        <td ID="itemPlaceholder" runat="server">
                        </td>
                    </tr>
                </GroupTemplate>
                <InsertItemTemplate>
                      
                </InsertItemTemplate>
                <ItemTemplate>
                    <td runat="server" style="background-color:#FFF8DC;">
                       <asp:Label ID="wishlistnameLabel" runat="server"  Text='<%# Eval("wishlistname") %>' /><br />
                          <small>created on: <asp:Label ID="createdLabel" runat="server" Text='<%#  Eval("created").ToString().Substring (1,10) %>' />
                        </small><br />
                         &nbsp;<asp:Label ID="male_lnameLabel" runat="server" 
                            Text='<%# Eval("male_lname") %>' />
                         &nbsp;<asp:Label ID="male_fnameLabel" runat="server" 
                            Text='<%# Eval("male_fname") %>' />
                         
                        <asp:Label ID="male_emailLabel" runat="server" 
                            Text='<%# Eval("male_email") %>' />
                         &nbsp;<asp:Label ID="female_fnameLabel" runat="server" 
                            Text='<%# Eval("female_fname") %>' />
                         &nbsp;<asp:Label ID="female_lnameLabel" runat="server" 
                            Text='<%# Eval("female_lname") %>' />
                         
                        <asp:Label ID="female_emailLabel" runat="server" 
                            Text='<%# Eval("female_email") %>' />
                         &nbsp;<asp:Label ID="wedding_dateLabel" runat="server" 
                            Text='<%# Eval("wedding_date") %>' /> 
                            <br /><small>place:
                        <asp:Label ID="wedding_placeLabel" runat="server" 
                            Text='<%# Eval("wedding_place") %>' /></small><br />

                         <small>category: <asp:Label ID="cat_nameLabel" runat="server" 
                            Text='<%# Eval("cat_name") %>' /></small> 
                        <br />
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                CommandName="Select" Text='<%#  Bind("Expr1") %>'></asp:LinkButton>
                    </td>
                </ItemTemplate>
                <LayoutTemplate>
                    <table runat="server">
                        <tr runat="server">
                            <td runat="server">
                                <table ID="groupPlaceholderContainer" runat="server" border="1" 
                                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                    <tr ID="groupPlaceholder" runat="server">
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr runat="server">
                            <td runat="server" 
                                style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                                <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                                    <Fields>
                                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                            ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                        <asp:NumericPagerField />
                                        <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                            ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                    </Fields>
                                </asp:DataPager>
                            </td>
                        </tr>
                    </table>
                </LayoutTemplate>
                <SelectedItemTemplate>
                    <td runat="server" style="background-color:#FFF8DC;">
                        <asp:Label ID="wishlistnameLabel" runat="server"  Text='<%# Eval("wishlistname") %>' /><br />
                          <small>created on: <asp:Label ID="createdLabel" runat="server" Text='<%#  Eval("created").ToString().Substring (1,10) %>' />
                        </small> <br />
                         &nbsp;<asp:Label ID="male_lnameLabel" runat="server" 
                            Text='<%# Eval("male_lname") %>' />
                         &nbsp;<asp:Label ID="male_fnameLabel" runat="server" 
                            Text='<%# Eval("male_fname") %>' />
                         
                        <asp:Label ID="male_emailLabel" runat="server" 
                            Text='<%# Eval("male_email") %>' />
                         &nbsp;<asp:Label ID="female_fnameLabel" runat="server" 
                            Text='<%# Eval("female_fname") %>' />
                         &nbsp;<asp:Label ID="female_lnameLabel" runat="server" 
                            Text='<%# Eval("female_lname") %>' />
                         
                        <asp:Label ID="female_emailLabel" runat="server" 
                            Text='<%# Eval("female_email") %>' />
                         &nbsp;<asp:Label ID="wedding_dateLabel" runat="server" 
                            Text='<%# Eval("wedding_date") %>' /> 
                            <br /><small>place:
                        <asp:Label ID="wedding_placeLabel" runat="server" 
                            Text='<%# Eval("wedding_place") %>' /></small><br />

                         <small>category: <asp:Label ID="cat_nameLabel" runat="server" 
                            Text='<%# Eval("cat_name") %>' /></small> 
                        <br />
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                CommandName="Select" Text='<%#  Bind("Expr1") %>'></asp:LinkButton>
                    </td>
                </SelectedItemTemplate>
            </asp:ListView>
            <br />
                    <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
                        DataKeyNames="id" DataSourceID="SqlDataSource2" CellPadding="4" 
                        ForeColor="#333333" GridLines="None" 
                onselectedindexchanged="GridView3_SelectedIndexChanged">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="title" HeaderText="title" 
                                SortExpression="titile" />
                            <asp:TemplateField HeaderText="Link" SortExpression="url">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("url") %>'></asp:TextBox>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Literal ID="L1" runat="server" Text='<%# Bind("url") %>'></asp:Literal>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                            <asp:BoundField DataField="price" HeaderText="price" SortExpression="price" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                                    <ajaxToolkit:SliderExtender ID="TextBox4_SliderExtender" runat="server" 
                                        BoundControlID="TextBox5" Enabled="True" 
                                        Maximum="100" Minimum="0" TargetControlID="TextBox4" TooltipText="Percent" 
                                        EnableHandleAnimation="True" Length="100" Steps="5">
                                    </ajaxToolkit:SliderExtender>
                                    <asp:TextBox ID="TextBox5" runat="server" Width="50px"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                        <SortedAscendingCellStyle BackColor="#FDF5AC" />
                        <SortedAscendingHeaderStyle BackColor="#4D0000" />
                        <SortedDescendingCellStyle BackColor="#FCF6C0" />
                        <SortedDescendingHeaderStyle BackColor="#820000" />
                    </asp:GridView>
            <br />
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
</table>
</asp:Content>
